package com.feeyin.radar.crm.dao.impl;

import com.feeyin.radar.crm.dao.ContractTempDAO;
import com.feeyin.radar.crm.model.Contract;
import org.springframework.orm.ibatis.SqlMapClientTemplate;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

public class ContractTempDAOImpl extends SqlMapClientDaoSupport
  implements ContractTempDAO
{
  public Contract getContractTempByContractId(Integer contractId)
  {
    if (contractId == null) return null;
    return (Contract)getSqlMapClientTemplate().queryForObject("getContractTempByContractId", contractId);
  }

  public boolean insertContractTemp(Contract contract) {
    if (contract == null) return false;
    Integer result = (Integer)getSqlMapClientTemplate().insert("insertContractTemp", contract);
    return result != null;
  }

  public boolean deleteContractTempByContractId(Integer contractId)
  {
    if (contractId == null) return false;
    Integer result = Integer.valueOf(getSqlMapClientTemplate().delete("deleteContractTempByContractId", contractId));
    return result != null;
  }
}